package algorithm_study.leecode;

import java.util.Scanner;

public class Card {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int []cards=new int[10];
        for(int i=0;i<cards.length;i++){
            cards[i]=2021;
        }
        boolean flag=true;
        for(int i=1;;i++){
            String temp=i+"";
            for(int j=0;j<temp.length();j++){
                int t=temp.charAt(j)-48;
                if(cards[t]>1){
                    cards[t]=cards[t]-1;
                }else{
                    flag=false;
                    break;
                }
            }
            if(!flag){
                System.out.print(i);
                break;
            }
        }
        scan.close();
    }
}
